#!/usr/perl/perl580/bin/perl 

use Algorithm::Cluster;

$|++;

$^W = 1;
use strict;

my $weight2 = [ 1,1 ];

my $data2 = [
    [ 1.1, 1.2 ],
    [ 1.4, 1.3 ],
    [ 1.1, 1.5 ],
    [ 2.0, 1.5 ],
    [ 1.7, 1.9 ],
    [ 1.7, 1.9 ],
    [ 5.7, 5.9 ],
    [ 5.7, 5.9 ],
    [ 3.1, 3.3 ],
    [ 5.4, 5.3 ],
    [ 5.1, 5.5 ],
    [ 5.0, 5.5 ],
    [ 5.1, 5.2 ],
];

my $mask2 = [
    [ 1, 1 ],
    [ 1, 1 ],
    [ 1, 1 ],
    [ 1, 1 ],
    [ 1, 1 ],
    [ 1, 1 ],
    [ 1, 1 ],
    [ 1, 1 ],
    [ 1, 1 ],
    [ 1, 1 ],
    [ 1, 1 ],
    [ 1, 1 ],
    [ 1, 1 ],
];

my $data3 = [
    [ 1.1, 2.2, 3.3, 4.4, 5.5, ], 
    [ 3.1, 3.2, 1.3, 2.4, 1.5, ], 
    [ 4.1, 2.2, 0.3, 5.4, 0.5, ], 
    [ 12.1, 2.0, 0.0, 5.0, 0.0, ], 
];

my $mask3 = [
    [ 1, 1, 1, 1, 1, ], 
    [ 1, 1, 1, 1, 1, ], 
    [ 1, 1, 1, 1, 1, ], 
    [ 1, 1, 1, 1, 1, ], 
];

my $weight3 =  [ 1,1,1,1,1 ];

my %params = (
    transpose =>         0,
    dist      =>       'e',
    data      =>    $data2,
    mask      =>    $mask2,
    weight    =>  $weight2,
    niter     =>       100,
);

my ($clusterid);
my ($i);

$clusterid = Algorithm::Cluster::somcluster(%params);

$i=0;
foreach(@{$clusterid}) {
    printf("Gene %2d assigned to cell (%2d,%2d)\n",$i++,$_->[0],$_->[1]);
}


__END__
